/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package yuhuibear.poat.object.convertor;

import java.math.BigDecimal;
import java.math.BigInteger;

/**
 * 特殊类型的转换器
 * 
 * @author yuhuibear
 */
public class ValueConvertor {

	public static Object convert(Object obj) throws Exception {
		if (obj == null)
			return obj;
		Class<?> objType = obj.getClass();
		if (objType.equals(BigDecimal.class))
			return BigDecimal.class.cast(obj).doubleValue();
		else if (objType.equals(BigInteger.class))
			return BigInteger.class.cast(obj).longValue();
		return obj;
	}
}
